import { http } from "@/utils/http";

export interface SearchFirmwareParams {
  pageNum?: number;
  pageSize?: number;
}
//查询
export const getFirmwareListApi = (params?: SearchFirmwareParams) => {
  return http.request("get", "/firmware", {
    params
  });
};

//上传固件

export interface UploadFirmwareParams {
  version: string; // 对应 Firmware.version
  remark: string; // 对应 Firmware.remark
  uploadUser: string; // 对应 Firmware.uploadUser
}


/**
 * 更新固件
 * @param data
 */
export const uploadFirmwareApi = data => {
  return http.request(
    "post",
    "/firmware",
    {
      data
    },
    {
      headers: {
        "Content-Type": "multipart/form-data"
      }
    }
  );
};

//删除固件
export const deleteFirmwareApi = (firmwareId: number) => {
  return http.request("delete", `/firmware/${firmwareId}`);
};

export interface Result<T> {
  msg?: string;
  code?: number;
  data: T;
}
